<?php echo $this->render('picture/special/_tab.phtml');?>
<form action="" method="post">
<?php if(system_controller_front::getInstance()->getRequest()->getParam('o')) { ?>
<?php echo $this->form()->hidden('referer', $this->referer) . "\n";?>
<div class="body">
	<table class="form">
		<tr>
			<th colspan="2"><?php echo $this->language('RECOMMEND GROUP INFORMATION');?>:</th>
		</tr>
		<tr>
			<td width="180"><label><span class="red">*</span> <?php echo $this->language('Name');?></label></td>
			<td>
				<?php echo $this->form()->text('name', $this->group->getName(), array('size'=>'20', 'maxlength'=>'20'));?>
				<code><?php echo $this->language('Between 1~20 characters and constructed by [a-zA-Z0-9].');?></code>
			</td>
		</tr>
		<tr>
			<td><label><span class="red">*</span> <?php echo $this->language('Description');?></label></td>
			<td>
				<?php echo $this->form()->text('description', $this->group->getDescription(), array('size'=>'50', 'maxlength'=>'50'));?>
				<code><?php echo $this->language('Between 1~50 characters and constructed by any character.');?></code>
			</td>
		</tr>
		<tr>
			<td></td>
			<td>
				<button type="submit" name="submit" value="submit"><?php echo $this->language('Submit');?></button>
				<?php if($this->group->getId()) {echo $this->render('include/deleteButton.phtml');}?>
			</td>
		</tr>
	</table>
</div>
<?php } else { ?>
<?php $this->headScript()->appendFile(_STATIC_HTTP . '/jquery/checkAll.js');?>
<div class="body">
	<table class="list">
		<tr>
			<th class="narrow">KEY</th>
			<th><?php echo $this->language('NAME');?></th>
			<th class="narrow"><?php echo $this->language('SPECIAL');?></th>
			<th class="time"><?php echo $this->language('CREATION');?></th>
			<th class="narrow center"><?php echo '<input type="checkbox" name="select-all" id="select-all" value="1" rel="id[]" />';?></th>
		</tr>
		<?php foreach($this->list AS $key => $row) { ?>
		<tr>
			<td class="key"><?php echo $row->getName();?></td>
			<td><a href="<?php echo $this->url('picture/special/regroup', array('o' => 'edit', 'id' => $row->getId()));?>"><?php echo $this->escape($row->getDescription());?></a></td>
			<td class="center"><a href="<?php echo $this->url('picture/special/recommend', array(), array('group_id' => $row->getId()));?>">Go»</a></td>
			<td class="time"><?php echo $this->date($row->getCreationtime());?></td>
			<td class="center"><?php
			if(in_array($row->getId(), (array) $this->checkedList)) {
				$checked = array('checked' => 'checked');
			} else {
				$checked = array();
			}
			echo $this->form()->checkbox('id[]', $row->getId(), array_merge(array('id' => 'id-' . $row->getId()), $checked));
			?></td>
		</tr>
		<?php } ?>
		<?php if(count($this->list) <= 0) {?>
		<tr>
			<td colspan="5" class="nohover">
				<div class="msg">
					<div class="common error" style="border:0;background:#fff;">
						<i class="icon"></i>
						<h4>STOP</h4>
						<div class="msg-bd">
							No Group found. <a href="<?php echo $this->url('picture/special/regroup', array('o' => 'addnew'));?>"><?php echo $this->language('Create')?></a>
						</div>
					</div>
				</div>
			</td>
		</tr>
		<?php } ?>
	</table>
</div>
<div class="body">
	<div style="float:right;margin-bottom:5px;">
		<?php echo $this->render('include/deleteButton.phtml');?>
	</div>
	<div class="page"><a href="<?php echo $this->url('picture/special/regroup', array('o' => 'addnew'));?>"><?php echo $this->language('Create New Group')?> »</a></div>
</div>
<?php } ?>
</form>
